using System;
using System.Text;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using RealState.BusinessObjects;
using RealState.DAL;

namespace RealState.BLL
{
	public class NewsBLL
	{
		private NewsDAO _NewsDAO;

		public NewsDAO NewsDAO
		{
			get { return _NewsDAO; }
			set { _NewsDAO = value; }
		}

		public NewsBLL()
		{
			NewsDAO = new NewsDAO();
		}
		public List<News> GetNewss()
		{
			try
			{
				return NewsDAO.GetNewss();
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
        public List<News> GetNewss_2()
        {
            try
            {
                return NewsDAO.GetNewss_2();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
		public News GetNews(int Id)
		{
			try
			{
				return NewsDAO.GetNews(Id);
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public int AddNews(News oNews)
		{
			try
			{
				return NewsDAO.AddNews(oNews);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateNews(News oNews)
		{
			try
			{
				return NewsDAO.UpdateNews(oNews);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveNews(News oNews)
		{
			try
			{
				return NewsDAO.RemoveNews(oNews);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveNews(int Id)
		{
			try
			{
				return NewsDAO.RemoveNews(Id);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public List<News> DeserializeNewss(string Path)
		{
			try
			{
				return GenericXmlSerializer<List<News>>.Deserialize(Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public void SerializeNewss(string Path, List<News> Newss)
		{
			try
			{
				GenericXmlSerializer<List<News>>.Serialize(Newss, Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}
